let userName = document.querySelector('.userName');
let userPswd1 = document.querySelector('#userPswd1');
let img_userName = document.querySelector('#img_userName');
let img_userPswd1 = document.querySelector('#img_userPswd1');
let img_userPswd2 = document.querySelector('#img_userPswd2');

// 鼠标点击输入框外面时，对输入框的值进入格式验证，并在旁边提示信息
userName.onblur = function testName() {
    let reg = /^\w{6,12}$/;
    let flag = reg.test(userName.value);
    if (flag) {
        img_userName.src = "/images/register.js/right.png";
    } else {
        img_userName.src = "/images/register.js/error.png";
    }
}

userPswd1.onblur = function testName() {
    let reg = /^\w{6,12}$/;
    let flag = reg.test(userPswd1.value);
    if (flag) {
        img_userPswd1.src = "/images/register.js/right.png";
    } else {
        img_userPswd1.src = "/images/register.js/error.png";
    }
}

userPswd2.onblur = function testName() {
    let reg = /^\w{6,12}$/;
    let flag = reg.test(userPswd2.value);
    if (flag && userPswd1.value == userPswd2.value) {
        img_userPswd2.src = "/images/register.js/right.png";
    } else {
        img_userPswd2.src = "/images/register.js/error.png";
    }
}

// 提交表单数据
let form_submit = document.querySelector('.form-submit');
let form_input = document.querySelector('#form_input');
function doSumbitForm() {
    form_input.submit();

    //获取表单数据：账户名和密码
    var username = form_input.userName.value;
    var password = form_input.userPswd2.value;
   
}
